#
study_name = 'study_spla_pos_02'
#
import numpy as np
#
if __name__ == '__main__':
    source_python = r'\\MA-CASTRO\abaqus-conecyl-python'
    import sys
    import os
    study_dir  = os.path.join( r'C:\Temp','abaqus',study_name )
    if not os.path.isdir( study_dir ):
        os.makedirs( study_dir )
    python_dir = os.path.join( study_dir, 'abaqus-conecyl-python' )
    output_dir = os.path.join( study_dir,'outputs' )
    print 'configuring folders...'
    print '\t' + python_dir
    print '\t' + output_dir
    if not os.path.isdir( output_dir ):
        os.makedirs( output_dir )
    if not os.path.isdir( python_dir ):
        os.makedirs( python_dir )
    os.system('copy ' + source_python + ' ' + python_dir + '') 
    sys.path.append( python_dir )
    #
    import study
    study = reload( study )
    from study import Study
    std = Study()
    std.name = study_name
    std.rebuild()
    cnames = [\
               #'r_100_h_200',
               #'r_200_h_400',
               'r_400_h_800',
               #'r_100_h_800', #slender
               'r_400_h_200', #short
              ]
    ploads = [ 25., 50. ]
    ppoints = [ 0.10, 0.25, 0.50 ]
    for cname in cnames:
        for ppointname, ppoint in ppoints.iteritems():
            for ploadname, pltotal in ploads.iteritems():
                cc = std.add_cc_fromDB( cname )
                cc.ploadconf.ploads = []
                cc.ploadconf.add_pload(
                    theta=  0.,
                    pt = ppoint,
                    pltotal = pltotal )
                cc.numel_r = 160.
                cc.axialdispl = 10.
                cc.rebuild()
    std.create_models()
